package com.ir;

import com.sysdep.CodeGenerator;
import com.asm.Label;

public class CJump extends Stmt {
    Expr cond;
    Label thenLabel;
    Label elseLabel;

    public CJump(Expr cond, Label thenLabel, Label elseLabel) {
        this.cond = cond;
        this.thenLabel = thenLabel;
        this.elseLabel = elseLabel;
    }

    public Expr getCond() {
        return cond;
    }

    public Label getElseLabel() {
        return elseLabel;
    }

    public Label getThenLabel() {
        return thenLabel;
    }

    public void accept(CodeGenerator cg) {
        cg.visit(this);
    }

    @Override
    public String getString() {
        return "CJump-" + cond.toString() + "-" + thenLabel.toString() + "-" + elseLabel.toString();
    }
}
